<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ page contentType="text/html; charset=utf-8" language="java"
	import="java.sql.*" errorPage=""%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- TemplateBeginEditable name="doctitle" -->
<title>Ajouter un nouveau indicateur</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<style type="text/css">
<!--
-->
</style>
<link href="<%=request.getContextPath()%>/css/css_style.css"
	rel="stylesheet" type="text/css">
</head>
<script type="text/javascript">

function chargerIndicateurs(){
	if (document.getElementById("theme").value != "0"){
		document.forms["formConsultation"].action = '<%=request.getContextPath()%>/consultations/getIndicateursTheme.action';
		document.forms["formConsultation"].submit();
	}
}

function chargerProvinces(){
	if (document.getElementById("region").value != "0"){
		document.forms["formConsultation"].action = '<%=request.getContextPath()%>/consultations/getProvincesRegion.action';
		document.forms["formConsultation"].submit();
	}
}

function chargerCommunes(){
	if (document.getElementById("province").value != "0"){
		document.forms["formConsultation"].action = '<%=request.getContextPath()%>/consultations/getCommunesProvince.action';
		document.forms["formConsultation"].submit();
	}
}

function chargerPOI(){
	if (document.getElementById("commune").value != "0"){
		document.forms["formConsultation"].action = '<%=request.getContextPath()%>/consultations/getPOICommune.action';
			document.forms["formConsultation"].submit();
		}
	}
	
function chargerPeriodique(){
	var periodique = true;
	}
</script>
<body>
	<div class="container">
		<div class="header"></div>
		<div class="upmenu">
			<div style="text-align: left; float: left; margin-left: 10px;">
				Bienvenue :
				<s:property value="#session.nom" />
				<s:property value="#session.prenom" />
			</div>
			<div style="text-align: right; float: right; margin-right: 10px;">
				<a href="<%=request.getContextPath()%>/users/logout.action">Se
					deconnecter</a>
			</div>
		</div>
		<div class="leftmenu">
				<ul id="menu-accordeon">
   <li><a href="<%=request.getContextPath()%>/themes/ListeThemes.action">Liste des thémes</a>
   
   </li>
		</div>
		<div class="content">
			<div class="content-header">Consultation</div>
			<div class="content-core">
				<s:fielderror></s:fielderror>

				<form name="formConsultation"
					action="<%=request.getContextPath()%>/themes/AfficherGraphe.action">





					</br> <label>Liste themes :</label>
					<c:choose>
						<c:when test="${not empty ListeThemes}">
							<s:select id="theme" name="idTheme"
								listKey="identifiant" listValue="description"
								 list="ListeThemes"
								onchange="chargerIndicateurs();" />
						</c:when>
						<c:otherwise>

                            <select name="idTheme" id="theme">
								<option value="0">Choisissez le thème</option>
							</select>						
						</c:otherwise>
					</c:choose>

					</br> <label>Liste indicateurs :</label>
					<c:choose>
						<c:when test="${not empty ListeIndicateurs}">
							<s:select id="indicateur" name="idIndicateur" 
								listKey="identifiant" listValue="libelle"
								 list="ListeIndicateurs" />
						</c:when>
						<c:otherwise>

	                            <select name="idIndicateur" id="indicateur">
								<option value="0">Choisissez l'indicateur</option>
							</select>	
						</c:otherwise>
					</c:choose>


					</br> <label>Liste regions :</label>
					<c:choose>
						<c:when test="${not empty ListeRegions}">
							<s:select id="region" name="idRegion" headerKey="0"
								listKey="identifiant" listValue="description"
								headerValue="Choisissez la region" list="ListeRegions"
								onchange="chargerProvinces();" />
						</c:when>
						<c:otherwise>

										<select name="idRegion" id="region">
								<option value="0">Choisissez la region</option>
							</select>
						</c:otherwise>
					</c:choose>


					</br> <label>Liste provinces :</label>
					<c:choose>
						<c:when test="${not empty ListeProvinces}">

							<s:select id="province" name="idProvince" headerKey="0"
								listKey="identifiant" listValue="description"
								headerValue="Choisissez la province" list="ListeProvinces"
								onchange="chargerCommunes();" />
						</c:when>
						<c:otherwise>

							<select name="idProvince" id="province">
								<option value="0">Choisissez la province</option>
							</select>
						</c:otherwise>
					</c:choose>

					</br> <label>Liste communes :</label>
					<c:choose>
						<c:when test="${not empty ListeCommunes}">

							<s:select id="commune" name="idCommune" headerKey="0"
								listKey="identifiant" listValue="description"
								headerValue="Choisissez la commune" list="ListeCommunes"
								onchange="chargerPOI();" />
						</c:when>
						<c:otherwise>

                            <select name="idCommune" id="commune">
								<option value="0">Choisissez la commune</option>
							</select>								</c:otherwise>
					</c:choose>

					</br> <label>Liste POI :</label>
					<c:choose>
						<c:when test="${not empty ListePoi}">

							<s:select id="poi" name="idPoi" headerKey="0"
								listKey="identifiant" listValue="description"
								headerValue="Choisissez le POI" list="ListePoi" />
						</c:when>
						<c:otherwise>

									<select name="idPoi" id="poi">
								<option value="0">Choisissez le POI</option>
							</select>
								</c:otherwise>
					</c:choose>

					</br>

					<FORM>
						Annee fixe <INPUT type="radio" name="annee" value="fixe" onchange="chargerFixe();">
                        Periode<INPUT type="radio" name="annee" value="periodique" onchange="chargerPeriodique();"> 
					</FORM>

					</br> <label>Les années :</label>
					<c:choose>
						<c:when test="${periodique == true }">

							  <select name="idannee" id="anneeAffichee">
								<option value="0">Choisissez l'qdscfdfqsannee</option>
							</select>
						</c:when>
						
						<c:when test="${periodique != true}">

							  <select name="idannee" id="anneeAffichee">
								<option value="0">Choisissez l'qdscfdfqsannee</option>
							</select>
							
							<select name="idannee" id="anneeAffichee">
								<option value="0">Choisissez l'qdscfdfqsannee</option>
							</select>
						</c:when>
						<c:otherwise>

	                        <select name="idannee" id="anneeAffichee">
								<option value="0">Choisissez l'annee</option>
							</select>								
						</c:otherwise>
					</c:choose>

					</tr>

					<tr>
						<s:submit value="Go"></s:submit>

					</tr>

					</table>
					<s:textfield cssStyle="display:none;" name="identifiantIndicateur"
						value="%{#parameters['identifiantIndicateur']}"></s:textfield>

				</form>
				<s:if test="hasActionErrors()">
					<s:actionerror />
				</s:if>
			</div>
		</div>
	</div>
</body>
</html>